//
//  PanelView.m
//  ZhenPin
//
//  Created by fei on 14-7-9.
//  Copyright (c) 2014年 zhenpin. All rights reserved.
//

#import "PanelView.h"

@implementation PanelView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}
-(id)initWithFrame:(CGRect)frame andBackGroundImage:(NSString *)imgName{
    if (self = [super initWithFrame:frame]) {
        
        customBackGroundImageView = [[UIImageView alloc] initWithFrame:frame];
        customBackGroundImageView.userInteractionEnabled = YES;
        //引导页图片
//        NSString *path = [[NSBundle mainBundle] pathForResource:imgName ofType:@"png"];
        [customBackGroundImageView setImage:[UIImage imageNamed:imgName]];
        [self addSubview:customBackGroundImageView];
    }
    return self;
}

-(void)addClickedButtonWithFrame:(CGRect)btnFrame andNormalImage:(NSString *)nName andHelightImage:(NSString *)hName {
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = btnFrame;
    [button setImage:[UIImage imageNamed:nName] forState:UIControlStateNormal];
    [button setImage:[UIImage imageNamed:hName] forState:UIControlStateHighlighted];
    
    [button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
    [customBackGroundImageView addSubview:button];
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    
    
    
}

-(void)buttonClicked:(UIButton *)sender {
    if ([_panelDelegate respondsToSelector:@selector(completeShowAndHidden)]) {
        [_panelDelegate completeShowAndHidden];
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
